package com.qqserver.service;

import com.qqcommon.Message;

import java.util.HashMap;

/**
 * 当用户离线时，存储消息对象的仓库
 */
public class StoreMessage {
    private static HashMap<String, Message> messageHashMap = new HashMap<>();

    //存储消息对象
    public static void addMessage(String userId,Message message){
        messageHashMap.put(userId,message);
    }
    //查找
    public static Message getMessage(String userId){
        return messageHashMap.get(userId);
    }
    //删除
    public static void removeMessage(String userId){
        messageHashMap.remove(userId);
    }
}
